package com.example.authsystem.service;

import com.example.authsystem.dto.*;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;

import java.time.LocalDate;
import java.util.List;

@Tag(name = "统计业务服务", description = "数据统计分析服务接口")
@Hidden
public interface StatisticsService {

    @Operation(summary = "获取仪表板统计", description = "获取系统总览统计数据", hidden = true)
    @ApiResponse(responseCode = "200", description = "获取成功",
            content = @Content(schema = @Schema(implementation = DashboardStatsDto.class)))
    DashboardStatsDto getDashboardStats();

    @Operation(summary = "获取用户活动统计", description = "获取指定时间范围内的用户活动数据", hidden = true)
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "获取成功"),
            @ApiResponse(responseCode = "400", description = "日期参数错误")
    })
    List<UserActivityDto> getUserActivity(
            @Parameter(description = "开始日期", required = true, schema = @Schema(type = "string", format = "date"))
            LocalDate startDate,
            @Parameter(description = "结束日期", required = true, schema = @Schema(type = "string", format = "date"))
            LocalDate endDate
    );

    @Operation(summary = "获取系统性能指标", description = "获取系统运行性能统计数据", hidden = true)
    @ApiResponse(responseCode = "200", description = "获取成功",
            content = @Content(schema = @Schema(implementation = SystemMetricsDto.class)))
    SystemMetricsDto getSystemMetrics();

    @Operation(summary = "导出统计报表", description = "导出Excel格式的统计报表", hidden = true)
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "导出成功"),
            @ApiResponse(responseCode = "400", description = "参数错误")
    })
    byte[] exportStatisticsReport(
            @Parameter(description = "报表类型", required = true, schema = @Schema(type = "string"))
            String reportType,
            @Parameter(description = "开始日期", required = true, schema = @Schema(type = "string", format = "date"))
            LocalDate startDate,
            @Parameter(description = "结束日期", required = true, schema = @Schema(type = "string", format = "date"))
            LocalDate endDate
    );

    @Operation(summary = "获取用户统计", description = "获取指定用户的统计信息", hidden = true)
    UserStatsDto getUserStats(Long userId);

    @Operation(summary = "批量获取用户统计", description = "批量获取多个用户的统计信息", hidden = true)
    List<UserStatsDto> getBatchUserStats(List<Long> userIds);

    @Operation(summary = "获取用户活动统计", description = "获取指定时间范围内的用户活动统计数据")
    UserActivityDto getUserStatistics(@Parameter(description = "开始日期") LocalDate startDate,
                                      @Parameter(description = "结束日期") LocalDate endDate);

    @Operation(summary = "获取登录统计", description = "获取系统登录相关的统计数据")
    LoginStatsDto getLoginStatistics();

    @Operation(summary = "生成统计报告", description = "生成指定格式的统计报告文件")
    byte[] generateReport(@Parameter(description = "开始日期") LocalDate startDate,
                          @Parameter(description = "结束日期") LocalDate endDate,
                          @Parameter(description = "报告格式", example = "PDF") String format);

}
